<template name="_emailTokenError">
  <h2>Invalid authentication code. If it has been more than 15 minutes, the token has expired, otherwise you may have simply mistyped it.</h2>
</template>

<template name="_emailLinkIdentityError">
  <h2>
    To confirm your email address, you must be logged in as the account that created this link.
  </h2>
  {{error}}
</template>

<template name="addNewVerifiedEmailPowerboxConfiguration">
  {{#if state.error}}
    {{#focusingErrorBox}}
      {{state.error}}
    {{/focusingErrorBox}}
  {{/if}}

  {{#if state.enterEmail}}
    <form class="verified-email" name="enter-email">
      <input type="text" name="email" placeholder="enter email address" value={{email}}>
      {{#if alreadyVerified}}
        <button class="connect-button">Select</button>
      {{else}}
        <button class="connect-button" disabled={{#unless email}}true{{/unless}}>
          Send confirmation email
        </button>
      {{/if}}
    </form>
  {{/if}}

  {{#if state.sendingEmail }}
    <p>Sending to {{email}}...</p>
  {{/if}}

  {{#if state.enterToken }}
    {{#if state.error}}
    <div class="reset-row">
      <button name="reset" type="button">Try a different address</button>
    </div>
    {{/if}}
    <p>{{enterTokenMessage}}</p>
    <form class="verified-email" name="enter-token">
      <input type="text" name="token" placeholder="enter your token" value={{token}}>
      <button class="connect-button" disabled={{#unless token}}true{{/unless}}>Confirm</button>
    </form>
  {{/if}}

  {{#if state.sendingToken }}
    <p>Verifying token...</p>
  {{/if}}
</template>
